<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 输出所有的 水仙花   四个


        // 判断一个数是不是水仙花数    
        //    123    1*1*1 + 2*2*2 + 3*3*3   123

        function isFlower (num) {
            // var num = 123 ;
            var bai = parseInt(num / 100) ;
            var shi = parseInt(num % 100 / 10) ;
            var ge = parseInt(num % 10 / 1) ;
            if(bai * bai * bai + shi * shi * shi + ge * ge * ge === num) {
                return true
            } 
            return false
        }

        console.log(isFlower(123)) ;

    </script>
    
</body>
</html>